#ifndef Picture_First
#define Picture_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Port.h"
#include "Object.h"

class ObjArray;
class Collection;

enum PicCodes {
	cPicEnd= 0,
	cPicFont,
	cPicInk,
	cPicClip,
	cPicStartAngle,
	cPicEndAngle,
	cPicPensize,
	cPicPenCap,

	cPicStrokeRect,
	cPicStrokeRRect,
	cPicStrokeOval,
	cPicStrokeWedge,
	cPicStrokePoly,

	cPicFillRect,
	cPicFillOval,
	cPicFillRRect,
	cPicFillWedge,
	cPicFillPoly,

	cPicHint,
	cPicEsc,
	cPicShowBitmap,
	cPicShowPicture,

	cPicFirstAscii	= 32,
	cPicLastAscii	= 127,

	cPicXMove0      = 128,

	cPicMove        = 128+64+0,
	cPicLine        = 128+64+16,
	cPicCornerDia   = 128+64+32,
	cPicExtent      = 128+64+48
};

//---- Picture -----------------------------------------------------------------

class Picture: public Object {
public:
	MetaDef(Picture);

	Picture();
	Picture(const Rectangle &b, byte *pagebuf, long len, ObjArray *m);
	~Picture();

	int Length()
		{ return length; }
	const Point &Offset()
		{ return bbox.origin; }
	const Point &Size()
		{ return bbox.extent; }
	const Rectangle &BBox()
		{ return bbox; }

	void Set(const Rectangle &b, byte *pagebuf, long len, ObjArray *m);
	virtual void Show(const Rectangle &r, Port *port);

	OStream &PrintOn(OStream&);
	IStream &ReadFrom(IStream&);

	void CollectParts(Collection *col);

protected:
	byte *buf;
	int length;
	ObjArray *map;
	Rectangle bbox;
};

#endif
